<template>
  <div>
    {{ this.$store.state.name }}

    <h2>获取vuex里面设置的变量</h2>
    <p>名字1： {{ name1 }}</p>
    <p>名字2： {{ $store.state.name }}</p>
    <p>名字3： {{ name }}</p>
    <p>number: {{ number }}</p>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: '',
  computed: {
    name1() {
      return this.$store.state.name
    },
    ...mapState(['name', 'number'])
    // ...mapState(['name'],)
  }
}
</script>

<style lang="scss" scoped></style>
